#ifndef BUTTERFLY_H
#define BUTTERFLY_H

#include <QWidget>
#include <QTimer>
#include <QDesktopWidget>

namespace Ui {
class Butterfly;
}

class Butterfly : public QWidget
{
    Q_OBJECT

public:
    explicit Butterfly(QWidget *parent = nullptr);
    ~Butterfly();

    void flyButterfly();

protected:
    // 窗口重绘事件
    void paintEvent(QPaintEvent *event);
    // 鼠标按下事件
    void mousePressEvent(QMouseEvent* event);
    // 鼠标移动事件
    void mouseMoveEvent(QMouseEvent* event);

private:
    Ui::Butterfly *ui;
    QPixmap m_img;
    QTimer m_timer;
    bool m_isUp = false;
    QPoint m_pt;
    QDesktopWidget m_deskWg;
};

#endif // BUTTERFLY_H
